package info.wf0913.blogger_service.service.imp;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import info.wf0913.blogger_core.service.imp.BaseServiceImp;
import info.wf0913.blogger_service.bean.Comment;
import info.wf0913.blogger_service.bean.Label;
import info.wf0913.blogger_service.service.CommentService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentServiceImp extends BaseServiceImp<Comment>  implements CommentService {

    /**
     * 分页查询评论内容
     * @param i 分页页码
     * @param i1 每页多条
     * @param commentIds 该评论内容的id集合
     * @return
     */
    @Override
    public Page<Comment> pages(int i, int i1, List<Integer> commentIds) {
        QueryWrapper<Comment> wrapper = new QueryWrapper<>();
        wrapper.in("id",commentIds);

        Page<Comment> page = new Page<>();
        page.setCurrent(i).setSize(i1);
        Page<Comment> commentPage = baseMapper.selectPage(page, wrapper);
        return commentPage;
    }
}
